<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$plugin_name = $_RQ['basicname'] ? $_RQ['basicname'] : '';
if($_RQ['op']=='get'){
	//显示统计数据
		$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$mounthtime =  mktime(0,0,0,date('m'),1,date('Y'));
		$wifiall=0;
		$wifishoplist=model('core/wechat_store')->getwifishoplist();
		$storeall=pdo_count('jy_weishop_store',array('uniacid'=>$_SESSION['uniacid']));
		if($wifishoplist['errcode'] == 0){
			foreach($storeall as $item){
				foreach($wifishoplist as $item){
					if($item['sid']==$id){
						$shop_id=$item['shop_id'];
					}
				}
				$shopdata=model('core/wechat_store')->getwifilist($shop_id);
				$wifiall +=count($shopdata['ssid_password_list']);
			}
		}
		$params=array('begin_date'=>date('Y-m-d',time()),'end_date'=>date('Y-m-d',$mounthtime));
		$wifidata=model('core/wechat_store')->getwifidata($params);
		if($wifidata['errcode']==0){
			$wifidata=$wifidata['data'];
		}
		$return['htmls']=array(
				array('type'=>'data','one_num'=>2,'title'=>'WIFI数据指标','datas'=>array(
					array('title'=>'门店总数','num'=>1,'data'=>$storeall),
					array('title'=>'WIFI总数','num'=>1,'data'=>$wifiall),
					array('title'=>'最近一个月','num'=>1,'data'=>$wifiall),
				)),
				array('type'=>'data','one_num'=>2,'title'=>'最近一个月WIFI数据','datas'=>array(
					array('title'=>'Wi-Fi连接总人数','num'=>1,'data'=>$wifidata['total_user']),
					array('title'=>'商家主页访问人数','num'=>1,'data'=>$wifidata['homepage_uv']),
					array('title'=>'新增公众号关注人数','num'=>1,'data'=>$wifidata['new_fans']),
					array('title'=>'累计公众号关注人数','num'=>1,'data'=>$wifidata['total_fans']),
					array('title'=>'微信方式连Wi-Fi人数','num'=>1,'data'=>$wifidata['wxconnect_user']),
					array('title'=>'连网后消息发送人数','num'=>1,'data'=>$wifidata['connect_msg_user']),
				)),
		);
	exi($return);
}